<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>
<script src="/layui/layui.js" charset="utf-8"></script>

<body>
    <div>
        账号：<input id="username" type="text" name="username" /> <br/>
        密码：<input id="password" type="password" name="password"> <br/>
        <button id="btn">登录</button> <a href="/admin/registerPage"><input type="button" value="注册"></a>
    </div>
</body>
<script>
    layui.use([ 'layer','jquery'] , function () {
        var $ = layui.jquery
            ,layer = layui.layer;

        $("#btn").click(function () {
            // 登录操作
            $.ajax({
                url:"/admin/login"
                ,dataType:"json"
                ,data:{username:$("#username").val() , password:$("#password").val() }
                ,success:function(data){
                    if (data.code == 200){
                        location.href = "/customerAdmin/main"
                    }else{
                        layer.msg(data.msg)
                    }
                }
            })
        })
    })
</script>
</html>